<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/fn"%>
<%@ taglib prefix="cfn" uri="http://com.abou/cfn"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@page import="com.abou.constant.product.*"%>
<%@ include file="../../constants.jsp"%>

<%-- The page URL --%>
<c:url var="pageUrl" value="/admin/product/create.do" />

<%-- The search form --%>
<form:form modelAttribute="product" cssClass="basic" id="productModifyForm"
	name="productCreateForm" action="${pageUrl}" enctype="multipart/form-data">

  	<%-- The mandatory fields info --%>
  	<%@ include file="/WEB-INF/jsp/common/form/mandatory.jsp"%>

	<%-- The global errors message --%>
	<jsp:include page="/WEB-INF/jsp/common/form/errors.jsp">
		<jsp:param name="code" value="form.errors" />
	</jsp:include>

	<fieldset class="classic">

	 	<legend><spring:theme code="field.product.legend.general"/></legend>

	  	<%-- The name field--%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-field-text.jsp">
			<jsp:param name="code" value="field.product.name" />
			<jsp:param name="path" value="name" />
			<jsp:param name="focused" value="true" />
			<jsp:param name="mandatory" value="true"/>
		</jsp:include>

		<%-- The price field--%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-field-text.jsp">
			<jsp:param name="code" value="field.product.price" />
			<jsp:param name="path" value="price" />
			<jsp:param name="mandatory" value="true"/>
		</jsp:include>

		<%-- The description field--%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-field-limited-text-area.jsp">
			<jsp:param name="code" value="field.product.description" />
			<jsp:param name="path" value="description" />
			<jsp:param name="rows" value="5" />
			<jsp:param name="cols" value="23" />
			<jsp:param name="mandatory" value="true"/>
			<jsp:param name="limit" value="200"/>
			<jsp:param name="id" value="description"/>
		</jsp:include>

	</fieldset>

	<fieldset class="classic">

	 	<legend><spring:theme code="field.product.legend.images"/></legend>

		<%-- The product image 1--%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-field-text.jsp">
			<jsp:param name="code" value="field.product.image1" />
			<jsp:param name="path" value="image1" />
			<jsp:param name="mandatory" value="true"/>
			<jsp:param name="type" value="file"/>
		</jsp:include>

		<%-- The product image 2 --%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-field-text.jsp">
			<jsp:param name="code" value="field.product.image2" />
			<jsp:param name="path" value="image2" />
			<jsp:param name="type" value="file"/>
		</jsp:include>

		<%-- The product image 3 --%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-field-text.jsp">
			<jsp:param name="code" value="field.product.image3" />
			<jsp:param name="path" value="image3" />
			<jsp:param name="type" value="file"/>
		</jsp:include>

		<%-- The product image 4 --%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-field-text.jsp">
			<jsp:param name="code" value="field.product.image4" />
			<jsp:param name="path" value="image4" />
			<jsp:param name="type" value="file"/>
		</jsp:include>
	</fieldset>

	<fieldset class="classic">

	 	<legend><spring:theme code="field.product.legend.specific"/></legend>

		<%-- The product type --%>
		<jsp:include page="/WEB-INF/jsp/common/form/form-product-types.jsp">
		    <jsp:param name="mandatory" value="true"/>
		    <jsp:param name="formId" value="productModifyForm"/>
		</jsp:include>

	</fieldset>

	<%-- The submit button --%>
	<div class="row">
		<label>&nbsp;</label>
		<span class="buttonsList">
	         <jsp:include page="/WEB-INF/jsp/common/cmp/button.jsp">
	           <jsp:param name="id" value="submitBt"/>
	           <jsp:param name="label" value="form.submit.create"/>
	           <jsp:param name="type" value="submit"/>
	         </jsp:include>
	     </span>
	</div>

</form:form>